﻿using Microsoft.Lync.Model.Group;

namespace SkypeSync
{
    class GroupWrapper
    {
        public delegate void NameChangedDelegate(string oldName, string newName);

        public event NameChangedDelegate NameChanged;
        Group _group;
        private string originalName;

        public override string ToString()
        {
            return _group.Name;
        }

        public Group LyncGroup
        {
            get
            {
                return _group;
            }
        }
        internal GroupWrapper(Group group)
        {
            _group = group;
            originalName = group.Name;
            _group.NameChanged += _group_NameChanged;
        }

        void _group_NameChanged(object sender, GroupNameChangedEventArgs e)
        {
            if (NameChanged != null)
            {
                NameChanged(originalName, e.NewName);
                originalName = e.NewName;
            }
        }
    }
}
